package file;

import java.io.File;

public class FileDemo {
    public static void main(String[] args) {
        /*

         */
        //File file1 = new File("C:/Users/z1824/IdeaProjects/JSD2004_ES/demo.txt");
        File file = new File("./demo.txt");

        //获取file对象表示的文件或目录的名字
        String name = file.getName();
        System.out.println(name);
        //获取file表示的文件的长度(单位是字节)
        long length = file.length();
        System.out.println(length +"字节");

        boolean cr = file.canRead();
        boolean cw = file.canWrite();
        System.out.println("是否可读:" + cr);
        System.out.println("是否可写:" + cw);

        boolean hidden = file.isHidden();
        System.out.println("是否隐藏:" + hidden);


    }
}
